<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="../../pub/taglibs.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>后台管理</title>
<%@include file="../../pub/resource.jsp"%>
<link href="<%=request.getContextPath()%>/assets/css/dpl-min.css" rel="stylesheet" type="text/css" />
<link href="<%=request.getContextPath()%>/assets/css/bui-min.css" rel="stylesheet" type="text/css" />
<link href="<%=request.getContextPath()%>/assets/css/main-min.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/css/skins/default.css" />
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/css/style.css" />
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/css/select2.css" />
<script type="text/javascript" src="<%=request.getContextPath()%>/js/select2.min.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/select2_locale_zh-CN.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/assets/js/bui-min.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/assets/js/common/main-min.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/assets/js/config-min.js"></script>
</head>
<body>
	<div class="header">
		<div class="dl-title">
			<!--<img src="/chinapost/Public/assets/img/top.png">-->
		</div>
		<div class="dl-log">
			欢迎您，<span class="dl-log-user">${sessionScope.name }</span>&nbsp;<span
				onclick="changPwd()" style="cursor: pointer;">修改密码</span><a
				href="loginOut.do" title="退出系统" class="dl-log-quit">[退出]</a>
		</div>
	</div>
	<div class="content">
		<div class="dl-main-nav">
			<div class="dl-inform">
				<div class="dl-inform-title">
					<s class="dl-inform-icon dl-up"></s>
				</div>
			</div>
			<ul id="J_Nav" class="nav-list ks-clear">
				<li class="nav-item dl-selected"><div
						class="nav-item-inner nav-home">菜单</div></li>
				<!-- <li class="nav-item dl-selected"><div
						class="nav-item-inner nav-order">业务管理</div></li> -->
			</ul>
		</div>
		<ul id="J_NavContent" class="dl-tab-conten">
		</ul>
	</div>
	<script>
		$(function(){
			BUI.use('common/main', function() {
				var config = [${tree}];
				new PageUtil.MainPage({
					modulesConfig : config
				});
			});
		});
		
		function changPwd(){
			$.dialog({
				title : "修改密码",
				lock : true,
				background : 'gray', // 背景色
				opacity : 0.65, // 透明度
				content : '<div>旧&nbsp;&nbsp;密&nbsp;&nbsp;码：<input type="password" name="oldPwd" id="oldPwd" placeholder="请输入旧密码"/></div><div style="margin-top:5px;">新&nbsp;&nbsp;密&nbsp;&nbsp;码：<input type="password" name="newPwd" id="newPwd" placeholder="请输入新密码"/></div><div style="margin-top:5px;">确认新密码：<input type="password" name="reNewPwd" id="reNewPwd" placeholder="再次输入新密码"/></div>',
				ok : function() {
					var oldPwd = $.trim($("#oldPwd").val());
					var newPwd = $.trim($("#newPwd").val());
					var reNewPwd = $.trim($("#reNewPwd").val());
					if (oldPwd == "") {
						$.dialog({
							id : "id1",
							content : "请输入旧密码!",
							lock : true,
							icon : "warning",
							path : rootPath+"/css",
							ok:true,
							okVal:"关闭"
						});
						return false;
					}
					if (newPwd == "") {
						$.dialog({
							id : "id1",
							content : "请输入新密码！",
							lock : true,
							icon : "warning",
							path : rootPath+"/css",
							ok:true,
							okVal:"关闭"
						});
						return false;
					}
					if (reNewPwd == "") {
						$.dialog({
							id : "id1",
							content : "请输入新密码！",
							lock : true,
							icon : "warning",
							path : rootPath+"/css",
							ok:true,
							okVal:"关闭"
						});
						return false;
					}
					if(newPwd!=reNewPwd){
						$.dialog({
							id : "id1",
							content : "两次密码输入不一致！",
							lock : true,
							icon : "warning",
							path : rootPath+"/css",
							ok:true,
							okVal:"关闭"
						});
						return false;
					}
					$.ajax({
								url : "changePWD.do",
								type : "post",
								dataType : "text",
								data : {
									oldPwd : oldPwd,
									reNewPwd:reNewPwd
								},
								success : function(data) {
									if ($.trim(data) == "success") {
										$.dialog({
											id : "id1",
											content : "修改成功，请你重新登录！",
											lock : true,
											icon : "warning",
											path : rootPath+"/css",
											ok:function(){
												window.location = "loginOut.do";
												return true;
											},
											okVal:"关闭"
										});
										
									}else{
										$.dialog({
											id : "id1",
											content : "旧密码输入错误，修改失败！",
											lock : true,
											icon : "warning",
											path : rootPath+"/css",
											ok:true,
											okVal:"关闭"
										});
									}
								}
							});
					return true;
				},
				okVal : "提交"
			});
		}
	</script>
</body>
</html>